const globaFn = {
  format: function(val) {
    val = Number(val)
    return val < 10 ? '0' + val : val
  },
  currentTime: function() {
    let date = new Date()
    let o = {
      yyyy: date.getFullYear(),
      m: this.format(date.getMonth() + 1),
      dd: this.format(date.getDate()),
      hh: this.format(date.getHours()),
      mm: this.format(date.getMinutes()),
      ss: this.format(date.getSeconds()),
      ms: date.getMilliseconds()
    }
    return `${o.yyyy}-${o.m}-${o.dd} ${o.hh}:${o.mm}:${o.ss}.${o.ms}`
  }
}
//axios请求头部公共信息
const baseHeader = {
  code: 0,
  devicetype: 3,
  msgtype: 0,
  sendingtime: globaFn.currentTime(),
  version: '1.0.01'
}

export default baseHeader
